import BaseMctApi from "@/framework/infra/base/BaseMctApi";
import MerchantReturnAddressEntity from "@/feature/mct/domain/entity/MerchantReturnAddressEntity";

class MerchantReturnAddressApi extends BaseMctApi {
  constructor() {
    super('merchant/return-address', MerchantReturnAddressEntity)
  }

  create(data) {
    const [province, city, region] = data.fullRegion.split(' ');
    data.province = province
    data.city = city
    data.region = region
    return this.post('create', data)
  }

  update(data) {
    const [province, city, region] = data.fullRegion.split(' ');
    data.province = province
    data.city = city
    data.region = region
    return this.post('update', data)
  }

  setAsDefault(id) {
    return this.post('set-as-default', {id})
  }
}

export const merchantReturnAddressApi = new MerchantReturnAddressApi()
